<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
   window
       location属性    {}   Location   location对象
       url    协议:port/资源地址
-->

<button>badiu</button>
<button>刷新</button>
<button>支付</button>
<script>
  var loc =  window.location;
  // 获取端口号
  console.log(loc.port);
  // 获取协议
  console.log(loc.protocol)
  //  localhost:63342
  console.log(loc.host)
  //  localhost
  console.log(loc.hostname)
  //  获取全路径
  console.log(loc.href)
  // 获取路径参数
  console.log(loc.search)


  document.getElementsByTagName("button")[0].onclick = function (){
    // 页面跳转   保存历史记录
    location.href = 'http://www.baidu.com'
    // 替换  不保存历史记录
    // location.replace('http://www.baidu.com')
  }


  document.getElementsByTagName("button")[1].onclick = function (){
    // 页面刷新
    location.reload()
  }

  document.getElementsByTagName("button")[2].onclick = function (){
    // 页面跳转
    location.href = './06-支付成功页.html'
  }
</script>
</body>
</html>